package operation;

import book.BookList;

import java.util.Scanner;

public class BorrowOperation implements Iop{
    @Override
    public void work(BookList bookList) {
        System.out.println("借阅图书");
        System.out.println("请输入你要借的书：");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        int size = bookList.getNum();
        for (int i = 0; i <size ; i++) {
            if (name.equals(bookList.getBooks(i).getName())){
                bookList.getBooks(i).setIsborrow(true);
                System.out.println("借阅成功！");
                return;
            }
        }
        System.out.println("没有这本书");
    }
}
